﻿using ReferenceTemplate.Models;
using ReferenceTemplate.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;

namespace ReferenceTemplate.Windows8.Services
{
    public class LinksService : ILinksService
    {
        public void OpenLink(Link link)
        {
            if (link != null)
            {
                var task = Windows.System.Launcher.LaunchUriAsync(new Uri(link.URL));
            }
        }

        public void CopyLink(Link link)
        {
            if (link != null)
            {
                var dataPackage = new DataPackage();
                dataPackage.SetText(link.URL);
                Clipboard.SetContent(dataPackage);
            }
        }
    }
}
